package com.example.demo.controller;


import com.example.demo.dao.UserInfoInterface;
import com.example.demo.entity.UserInfo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;



@Api("controller相关的登录/注册api")
@RestController
@RequestMapping("/UserInfo")
public class UserInfoController {
    private static final long serialVersionUID = 1L;

    @Autowired
    UserInfoInterface userInfoInterface;

    @RequestMapping(value="/User", produces = "application/json; charset=utf-8")
    @ResponseBody
    public UserInfo User(String string1){
        int id=Integer.parseInt(string1);
        UserInfo userInfo = userInfoInterface.select(id);
        return userInfo;
    }

    @RequestMapping(value="/Update", produces = "application/json; charset=utf-8")
    @ResponseBody
    public int Update(String string1,String string2){
        String name=string1;
        int id=Integer.parseInt(string2);
        int i = userInfoInterface.Update(name,id);
        return i;
    }

    @RequestMapping(value="/UpdateMoney", produces = "application/json; charset=utf-8")
    @ResponseBody
    public int UpdateMoney(String string1,String string2){
        int id=Integer.parseInt(string1);
        float money=Float.parseFloat(string2);
        int i = userInfoInterface.UpdateMoney(id,money);
        return i;
    }


}
